package com.example.springEvent;

import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author Administrator
 * @date 2020-2-5 0005
 */
@Service
public class EventService {

    @Resource
    private ApplicationContext applicationContext;

    public void sendEvent(String name){
        EventObject eventObject= new EventObject(name);
        Map<String,String> maps= new HashMap<>();
        maps.put("address","china");
        eventObject.data= maps;
        applicationContext.publishEvent(eventObject);
    }
}
